package ningbo.day08.oopstatic;

import java.sql.SQLOutput;

/**
 * @Author 宁铂
 * @Date 2021/7/18 17:51
 * @Version 1.0
 */
public class TestDemo {
    /** 测试多态的入门案例 */
    public static void main(String[] args) {
        Teacher teacher1 = new CGB("小红", 24, 26897423);
        Teacher teacher2 = new C("小李", 25, 52362653);

        System.out.println(teacher1.name);
        System.out.println(teacher1.age);
        System.out.println(teacher1.salary);

        teacher1.preparation();
        teacher1.Attend();


    }
}

class Teacher{
    String name ;
    int age;
    double salary;

    public void preparation(){
        System.out.println("备课");
    }

    public void Attend(){
        System.out.println("上课");
    }

    public Teacher(String name, int age, double salary) {
        this.name = name;
        this.age = age;
        this.salary = salary;
    }
}

class CGB extends Teacher{

    public CGB(String name, int age, double salary) {
        super(name, age, salary);
    }

    public void preparation(){
        System.out.println("为CGB备课");
    }

    public void Attend(){
        System.out.println("为CGB上课");
    }

}

class C extends Teacher{

    public C(String name, int age, double salary) {
        super(name, age, salary);
    }


    public void preparation(){
        System.out.println("为C备课");
    }

    public void Attend(){
        System.out.println("为C上课");
    }
}